#ifndef MESSAGETACKLEFUN_H
#define MESSAGETACKLEFUN_H

#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QObject>
#include <QThread>
#include <QMutex>
#include "udpsocket.h"
#include "websocketclient.h"




typedef struct tag_msg {
    uint32_t		message;
    uint32_t		wParam;
    void*			lParam;
    tag_msg()
    {
        message = -1;
        wParam = 0;
        lParam = nullptr;
    }

}_msg, *pmsg;

class MessageTackleFun:public QThread
{
    Q_OBJECT
public:
    enum MSG_SEND_
    {
        MSG_SEND_UDP,
        MSG_SEND_WEB,
    };

    enum JSON_ID
    {
        UDP_LOGIN_SEND = 1001,
        UDP_LOGIN_RECV = 1002,
    };

    MessageTackleFun();

    void sendMessage( pmsg msg  );

private:
    void run();
public slots:
    void login(QString user , QString password );
    void UdpMessageFun( void *p );
signals:
    void loginReasult(QByteArray byt);

private:
    QString userName;
    QString passWord;
    QList <_msg*> msgList;
    QMutex mutexList;
    udpsocket *m_udpsocket;
    WebSocketClient *m_WebSocketClient;
};

#endif // MESSAGETACKLEFUN_H
